package com.android.aqq.bean;

import java.util.ArrayList;
import java.util.Comparator;

import com.android.aqq.util.Comparators;

@SuppressWarnings("unchecked")
public class SortList<T> extends ArrayList {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8569538623196404761L;


	public synchronized boolean move(QQBuddy object) {
		Comparator comparator = Comparators.getComparator();
		super.remove(object);
		int size = size();
		for (int i=0; i<size; i++) {
			int c = comparator.compare(object, super.get(i));
			if (c<=0) {
				super.add(i, object);
				return true;
			}
		}
		super.add(object);
		return true;
	}
}
